Status:  U
Return-Path: <coco-bounces@maltedmedia.com>
Received: from carlin.mail.atl.earthlink.net ([207.69.200.104])
	by mdl-absent.atl.sa.earthlink.net (EarthLink SMTP Server) with SMTP id 1qpLAf6pw3Nl36W0; Thu, 26 May 2011 21:11:23 -0400 (EDT)
Received: from five.pairlist.net ([216.92.1.121])
	by carlin.mail.atl.earthlink.net (EarthLink SMTP Server) with ESMTP id 1qpLAe1Mr3Nl3q80
	for <sfischer1@mindspring.com>; Thu, 26 May 2011 21:11:22 -0400 (EDT)
Received: from five.pairlist.net (localhost [127.0.0.1])
	by five.pairlist.net (Postfix) with ESMTP id 56FD43BE57;
	Thu, 26 May 2011 21:11:21 -0400 (EDT)
X-Original-To: coco@lists5.maltedmedia.com
Delivered-To: coco@five.pairlist.net
Received: from deploy5.pair.com (qs281.pair.com [216.92.131.37])
	by five.pairlist.net (Postfix) with SMTP id 78FE83BE37
	for <coco@lists5.maltedmedia.com>; Thu, 26 May 2011 21:11:19 -0400 (EDT)
Received: (qmail 80229 invoked by uid 3002); 27 May 2011 01:11:19 -0000
Delivered-To: bathory-maltedmedia:com-coco@maltedmedia.com
Received: (qmail 80226 invoked from network); 27 May 2011 01:11:19 -0000
Received: from localhost.pair.com (HELO qs281.pair.com) (127.0.0.1)
	by localhost.pair.com with SMTP; 27 May 2011 01:11:19 -0000
Received: from localhost (localhost [127.0.0.1])
	by qs281.pair.com (Postfix) with SMTP id 25A84D4C5C
	for <coco@maltedmedia.com>; Thu, 26 May 2011 21:11:19 -0400 (EDT)
X-Virus-Check-By: qs281.pair.com
X-Spam-Check-By: qs281.pair.com
X-Spam-Status: No, hits=-2.6 required=5.0 tests=BAYES_00,
	STOX_REPLY_TYPE autolearn=ham version=3.002005
X-Spam-Flag: NO
X-Spam-Level: 
X-Spam-Filtered: 2339d97e2cf80afbc3f9b452dd9fb067
Received: from smtp.newsguy.com (smtp.newsguy.com [74.209.136.69])
	by qs281.pair.com (Postfix) with ESMTP id 7AAE3D4C59
	for <coco@maltedmedia.com>; Thu, 26 May 2011 21:11:17 -0400 (EDT)
Received: from P6X58D (adsl-065-013-138-248.sip.mcn.bellsouth.net
	[65.13.138.248])
	by smtp.newsguy.com (8.14.3/8.14.3) with SMTP id p4R1BGfp055297
	for <coco@maltedmedia.com>; Thu, 26 May 2011 18:11:16 -0700 (PDT)
	(envelope-from lothan@newsguy.com)
Message-ID: <D7B9C7AE2156463FA7EB18F57BDD7CDB@P6X58D>
From: "Lothan" <lothan@newsguy.com>
To: "CoCoList for Color Computer Enthusiasts" <coco@maltedmedia.com>
References: <20110526095217.GA15977@brawl.fslf.org><874216FA43694C15965E5BA5737019D7@Shasta>
	<20110526205718.GE23032@brawl.fslf.org>
In-Reply-To: <20110526205718.GE23032@brawl.fslf.org>
Date: Thu, 26 May 2011 21:11:05 -0400
MIME-Version: 1.0
X-Priority: 3
X-MSMail-Priority: Normal
Importance: Normal
X-Mailer: Microsoft Windows Live Mail 15.4.3508.1109
X-MimeOLE: Produced By Microsoft MimeOLE V15.4.3508.1109
Subject: Re: [Coco] cprep19a.lzh upload
X-BeenThere: coco@maltedmedia.com
X-Mailman-Version: 2.1.9
Precedence: list
Reply-To: CoCoList for Color Computer Enthusiasts <coco@maltedmedia.com>
List-Id: CoCoList for Color Computer Enthusiasts <coco.maltedmedia.com>
List-Unsubscribe: <http://five.pairlist.net/mailman/listinfo/coco>,
	<mailto:coco-request@maltedmedia.com?subject=unsubscribe>
List-Archive: <http://five.pairlist.net/pipermail/coco/>
List-Post: <mailto:coco@maltedmedia.com>
List-Help: <mailto:coco-request@maltedmedia.com?subject=help>
List-Subscribe: <http://five.pairlist.net/mailman/listinfo/coco>,
	<mailto:coco-request@maltedmedia.com?subject=subscribe>
Content-Transfer-Encoding: 7bit
Content-Type: text/plain; charset="us-ascii"; Format="flowed"
Sender: coco-bounces@maltedmedia.com
Errors-To: coco-bounces@maltedmedia.com
X-ELNK-Received-Info: spv=0;
X-ELNK-AV: 0
X-ELNK-Info: sbv=1; sbrc=-0; sbf=c0; sbw=000;

If I remember correctly, string constants are kept pretty much wherever they 
are defined in the code, so the location depends on the order of the 
modules/libraries being linked. I think cstart.r is linked first by cc1/cc2 
so it's right after the module header.

Globaql initialization data for other data types (and for some strings) is 
stored at the tail end of the executable. I'm looking at the disassembly for 
ansifront for example and I see "noname.c" is is in the initialization 
section at the end of the executable while all the other strings are in the 
middle of the code.

Look in cstart.a and you'll see at csta10 it copies the dp-data (direct page 
initialization data) from the executable into the direct page. At csta15 it 
copies the non-dp data from the end of the executable to the memory area 
right after the direct page. It then clears the bss data, relocates the 
data-text references (pointers to stuff in the executable module like 
function pointers and pointers to string constants), relocates the data-data 
references (pointers to stuff in the data area like pointers to structs), 
resets the stack, and processes the command-line arguments. The references 
are relocated because the C compiler/linker stores the pointers based on 
zero offsets, so it has to calculate the final addresses based on the 
location of the module and data area in memory.

-----Original Message----- 
From: Willard Goosey
Sent: Thursday, May 26, 2011 4:57 PM
To: CoCoList for Color Computer Enthusiasts
Subject: Re: [Coco] cprep19a.lzh upload

On Thu, May 26, 2011 at 08:13:08AM -0700, Stephen H. Fischer wrote:
>
> I now wonder how to make sure it is near the start of the binary. Part of
> Globals?

I believe global initialized data is right after the module header, yes.
That starts getting to be a complicated question about how rlink does
its magic, and I've never gone there. ;-)

Willard
-- 
Willard Goosey  goosey@sdc.org
Socorro, New Mexico, USA
I search my heart and find Cimmeria, land of Darkness and the Night.
  -- R.E. Howard

--
Coco mailing list
Coco@maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco 


--
Coco mailing list
Coco@maltedmedia.com
http://five.pairlist.net/mailman/listinfo/coco